<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.List" %>
<%@ page import="com.czxy.demo01.User" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: 宝贝嘉燕
  Date: 2021/9/27
  Time: 8:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    List<User>list=new ArrayList<>();
list.add(new User("张三","123",18));
list.add(new User("李四","456",19));
list.add(new User("王五","789",20));
pageContext.setAttribute("list",list);

%>
<c:forEach   items="${list}" var="u" varStatus="st"  >
${u.username}---${u.age}---当前遍历到了第${st.count}个---索引值是${st.index}---是集合的第一个么？${st.first}---是集合的最后一个么？${st.last}<br>

</c:forEach>
</body>
</html>
